package com.cjm.ry.jvm.p1;


import com.cjm.ry.jvm.bean.OnlyOneString;

import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.TimeUnit;

public class Demo2 {
    public static void main(String[] args) {
        new Thread(() -> {
            System.err.println("serr => " + LoaderTest.class.getName());
            System.err.println("serr => " + "xxx");
            System.err.println("serr => " + LoaderTest.aa);
            System.err.println("serr => " + "xxx");
            LoaderTest xx = new LoaderTest();
            System.err.println("serr => " + xx.getXx());
        }).start();
        try {
            TimeUnit.MINUTES.sleep(10);
        } catch (InterruptedException e) {
            throw new RuntimeException(e);
        }
    }

    private static void extracted() {
        List<OnlyOneString> OnlyOneStringList = new ArrayList<>(10);
        for (int i = 0; i < 10; i++) {
            OnlyOneString OnlyOneString = new OnlyOneString();
            OnlyOneString.setName("cjm_" + i);
            OnlyOneStringList.add(OnlyOneString);
        }
        a();
    }

    private static void a() {
        List<OnlyOneString> OnlyOneStringList = new ArrayList<>(10);
        for (int i = 0; i < 10; i++) {
            OnlyOneString OnlyOneString = new OnlyOneString();
            OnlyOneString.setName("cjm_" + i);
            OnlyOneStringList.add(OnlyOneString);
        }
        b();
    }

    private static void b() {
        List<OnlyOneString> OnlyOneStringList = new ArrayList<>(10);
        for (int i = 0; i < 10; i++) {
            OnlyOneString OnlyOneString = new OnlyOneString();
            OnlyOneString.setName("cjm_" + i);
            OnlyOneStringList.add(OnlyOneString);
        }
        c();
    }

    private static void c() {
        List<OnlyOneString> OnlyOneStringList = new ArrayList<>(10);
        for (int i = 0; i < 10; i++) {
            OnlyOneString OnlyOneString = new OnlyOneString();
            OnlyOneString.setName("cjm_" + i);
            OnlyOneStringList.add(OnlyOneString);
        }
        try {
            TimeUnit.HOURS.sleep(1);
        } catch (InterruptedException e) {
        }
    }
}
